<template>
  <div class="scene-management">


    <!-- 操作栏 -->
    <div class="management-toolbar">
      <div class="toolbar-left">
        <div class="search-box">
          <input 
            v-model="searchQuery" 
            type="text" 
            placeholder="搜索场景名称或类型..."
            class="search-input"
            @input="filterScenes"
          />
          <div class="search-icon">🔍</div>
        </div>
        <select v-model="filterType" @change="filterScenes" class="filter-select">
          <option value="">全部类型</option>
          <option value="主线">主线</option>
          <option value="支线">支线</option>
          <option value="活动">活动</option>
          <option value="特殊">特殊</option>
        </select>
      </div>
      <div class="toolbar-right">
        <button class="add-btn" @click="showAddModal = true">
          <span class="btn-icon">+</span>
          添加场景
        </button>
      </div>
    </div>

    <!-- 场景列表 -->
    <div class="scenes-grid" v-if="!loading">
      <div 
        v-for="scene in paginatedScenes" 
        :key="scene.sceneId"
        class="scene-card"
      >
        <div class="scene-image">
          <img 
            :src="scene.sceneImageUrl || '/src/assets/default-scene.jpg'" 
            :alt="scene.sceneName"
            class="scene-img"
          />
          <div class="scene-overlay">
            <div class="scene-actions">
              <button class="action-btn edit-btn" @click="editScene(scene)" title="编辑">
                ✏️
              </button>
              <button class="action-btn delete-btn" @click="deleteScene(scene)" title="删除">
                🗑️
              </button>
              <button class="action-btn landmark-btn" @click="manageLandmarks(scene)" title="管理地标">
                📍
              </button>
            </div>
          </div>
        </div>
        <div class="scene-info">
          <h3 class="scene-name">{{ scene.sceneName }}</h3>
          <p class="scene-type">{{ scene.sceneType }}</p>
          <p class="scene-description" v-if="scene.backgroundStory">
            {{ scene.backgroundStory.substring(0, 100) }}{{ scene.backgroundStory.length > 100 ? '...' : '' }}
          </p>
        </div>
      </div>
    </div>

    <!-- 分页 -->
    <div class="pagination" v-if="totalPages > 1">
      <button 
        class="page-btn" 
        :class="{ disabled: currentPage === 1 }"
        @click="changePage(currentPage - 1)"
        :disabled="currentPage === 1"
      >
        上一页
      </button>
      <span class="page-info">{{ currentPage }} / {{ totalPages }}</span>
      <button 
        class="page-btn" 
        :class="{ disabled: currentPage === totalPages }"
        @click="changePage(currentPage + 1)"
        :disabled="currentPage === totalPages"
      >
        下一页
      </button>
    </div>

    <!-- 加载状态 -->
    <div v-if="loading" class="loading-container">
      <div class="loading-spinner"></div>
      <p>加载中...</p>
    </div>

    <!-- 添加/编辑场景弹窗 -->
    <div v-if="showAddModal || showEditModal" class="modal-overlay" @click="closeModal">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h3>{{ showAddModal ? '添加场景' : '编辑场景' }}</h3>
          <button class="close-btn" @click="closeModal">×</button>
        </div>
        <div class="modal-body">
          <form @submit.prevent="showAddModal ? addScene() : updateScene()">
            <div class="form-group">
              <label>场景ID *</label>
              <input 
                v-model="formData.sceneId" 
                type="text" 
                required 
                :disabled="showEditModal"
                placeholder="请输入场景ID"
              />
            </div>
            <div class="form-group">
              <label>场景名称 *</label>
              <input 
                v-model="formData.sceneName" 
                type="text" 
                required 
                placeholder="请输入场景名称"
              />
            </div>
            <div class="form-group">
              <label>场景类型 *</label>
              <select v-model="formData.sceneType" required>
                <option value="">请选择类型</option>
                <option value="主线">主线</option>
                <option value="支线">支线</option>
                <option value="活动">活动</option>
                <option value="特殊">特殊</option>
              </select>
            </div>
            <div class="form-group">
              <label>背景故事</label>
              <textarea 
                v-model="formData.backgroundStory" 
                rows="4"
                placeholder="请输入背景故事"
              ></textarea>
            </div>
            <div class="form-group">
              <label>场景图片URL</label>
              <input 
                v-model="formData.sceneImageUrl" 
                type="url" 
                placeholder="请输入图片URL"
              />
            </div>
            <div class="form-actions">
              <button type="button" class="cancel-btn" @click="closeModal">取消</button>
              <button type="submit" class="submit-btn" :disabled="submitting">
                {{ submitting ? '提交中...' : (showAddModal ? '添加' : '更新') }}
              </button>
            </div>
          </form>
        </div>
      </div>
    </div>

    <!-- 删除确认弹窗 -->
    <div v-if="showDeleteModal" class="modal-overlay" @click="closeDeleteModal">
      <div class="modal-content delete-modal" @click.stop>
        <div class="modal-header">
          <h3>确认删除</h3>
          <button class="close-btn" @click="closeDeleteModal">×</button>
        </div>
        <div class="modal-body">
          <p>确定要删除场景 "{{ sceneToDelete?.sceneName }}" 吗？</p>
          <p class="warning-text">此操作将同时删除该场景下的所有地标，且无法恢复！</p>
          <div class="form-actions">
            <button class="cancel-btn" @click="closeDeleteModal">取消</button>
            <button class="delete-confirm-btn" @click="confirmDelete" :disabled="deleting">
              {{ deleting ? '删除中...' : '确认删除' }}
            </button>
          </div>
        </div>
      </div>
    </div>

    <!-- 地标管理弹窗 -->
    <div v-if="showLandmarkModal" class="modal-overlay" @click="closeLandmarkModal">
      <div class="modal-content landmark-modal" @click.stop>
        <div class="modal-header">
          <h3>{{ selectedScene?.sceneName }} - 地标管理</h3>
          <button class="close-btn" @click="closeLandmarkModal">×</button>
        </div>
        <div class="modal-body">
          <div class="landmark-toolbar">
            <button class="add-btn small" @click="showAddLandmarkModal = true">
              <span class="btn-icon">+</span>
              添加地标
            </button>
          </div>
          <div class="landmarks-list">
            <div v-if="landmarks.length === 0" class="empty-state">
              <p>暂无地标</p>
            </div>
            <div v-else>
              <div 
                v-for="landmark in landmarks" 
                :key="landmark.landmarkId"
                class="landmark-item"
              >
                <div class="landmark-image">
                  <img 
                    :src="landmark.landmarkImageUrl || '/src/assets/default-landmark.jpg'" 
                    :alt="landmark.landmarkName"
                  />
                </div>
                <div class="landmark-info">
                  <h4>{{ landmark.landmarkName }}</h4>
                  <p v-if="landmark.landmarkDesc">{{ landmark.landmarkDesc }}</p>
                </div>
                <div class="landmark-actions">
                  <button class="action-btn edit-btn" @click="editLandmark(landmark)" title="编辑">
                    ✏️
                  </button>
                  <button class="action-btn delete-btn" @click="deleteLandmark(landmark)" title="删除">
                    🗑️
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 添加/编辑地标弹窗 -->
    <div v-if="showAddLandmarkModal || showEditLandmarkModal" class="modal-overlay" @click="closeLandmarkFormModal">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h3>{{ showAddLandmarkModal ? '添加地标' : '编辑地标' }}</h3>
          <button class="close-btn" @click="closeLandmarkFormModal">×</button>
        </div>
        <div class="modal-body">
          <form @submit.prevent="showAddLandmarkModal ? addLandmark() : updateLandmark()">
            <div class="form-group">
              <label>地标ID *</label>
              <input 
                v-model="landmarkFormData.landmarkId" 
                type="text" 
                required 
                :disabled="showEditLandmarkModal"
                placeholder="请输入地标ID"
              />
            </div>
            <div class="form-group">
              <label>地标名称 *</label>
              <input 
                v-model="landmarkFormData.landmarkName" 
                type="text" 
                required 
                placeholder="请输入地标名称"
              />
            </div>
            <div class="form-group">
              <label>地标描述</label>
              <textarea 
                v-model="landmarkFormData.landmarkDesc" 
                rows="3"
                placeholder="请输入地标描述"
              ></textarea>
            </div>
            <div class="form-group">
              <label>地标图片URL</label>
              <input 
                v-model="landmarkFormData.landmarkImageUrl" 
                type="url" 
                placeholder="请输入图片URL"
              />
            </div>
            <div class="form-group">
              <label>视觉资源ID</label>
              <input 
                v-model="landmarkFormData.visualResourceId" 
                type="text" 
                placeholder="请输入视觉资源ID"
              />
            </div>
            <div class="form-actions">
              <button type="button" class="cancel-btn" @click="closeLandmarkFormModal">取消</button>
              <button type="submit" class="submit-btn" :disabled="submitting">
                {{ submitting ? '提交中...' : (showAddLandmarkModal ? '添加' : '更新') }}
              </button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { sceneApi } from '../api/scene.js'

export default {
  name: 'SceneManagement',
  data() {
    return {
      scenes: [],
      filteredScenes: [],
      landmarks: [],
      selectedScene: null,
      loading: false,
      submitting: false,
      deleting: false,
      
      // 搜索和筛选
      searchQuery: '',
      filterType: '',
      
      // 分页
      currentPage: 1,
      pageSize: 12,
      
      // 弹窗状态
      showAddModal: false,
      showEditModal: false,
      showDeleteModal: false,
      showLandmarkModal: false,
      showAddLandmarkModal: false,
      showEditLandmarkModal: false,
      
      // 表单数据
      formData: {
        sceneId: '',
        sceneName: '',
        sceneType: '',
        backgroundStory: '',
        sceneImageUrl: ''
      },
      
      landmarkFormData: {
        landmarkId: '',
        landmarkName: '',
        landmarkDesc: '',
        landmarkImageUrl: '',
        visualResourceId: '',
        sceneId: ''
      },
      
      // 待操作的数据
      editingScene: null,
      sceneToDelete: null,
      editingLandmark: null,
      landmarkToDelete: null
    }
  },
  
  computed: {
    totalPages() {
      return Math.ceil(this.filteredScenes.length / this.pageSize)
    },
    
    paginatedScenes() {
      const start = (this.currentPage - 1) * this.pageSize
      const end = start + this.pageSize
      return this.filteredScenes.slice(start, end)
    }
  },
  
  async mounted() {
    await this.loadScenes()
  },
  
  methods: {
    // 加载场景列表
    async loadScenes() {
      try {
        this.loading = true
        const response = await sceneApi.getAllScenes()
        if (response.code === 0) {
          this.scenes = response.data || []
          this.filterScenes()
        } else {
          this.$message?.error(response.message || '获取场景列表失败')
        }
      } catch (error) {
        console.error('加载场景失败:', error)
        this.$message?.error('加载场景失败，请稍后重试')
      } finally {
        this.loading = false
      }
    },
    
    // 筛选场景
    filterScenes() {
      let filtered = [...this.scenes]
      
      // 按名称或类型搜索
      if (this.searchQuery) {
        const query = this.searchQuery.toLowerCase()
        filtered = filtered.filter(scene => 
          scene.sceneName.toLowerCase().includes(query) ||
          scene.sceneType.toLowerCase().includes(query)
        )
      }
      
      // 按类型筛选
      if (this.filterType) {
        filtered = filtered.filter(scene => scene.sceneType === this.filterType)
      }
      
      this.filteredScenes = filtered
      this.currentPage = 1 // 重置到第一页
    },
    
    // 分页
    changePage(page) {
      if (page >= 1 && page <= this.totalPages) {
        this.currentPage = page
      }
    },
    
    // 场景操作
    editScene(scene) {
      this.editingScene = scene
      this.formData = { ...scene }
      this.showEditModal = true
    },
    
    deleteScene(scene) {
      this.sceneToDelete = scene
      this.showDeleteModal = true
    },
    
    async addScene() {
      try {
        this.submitting = true
        const response = await sceneApi.createScene(this.formData)
        if (response.code === 0) {
          this.$message?.success('场景添加成功')
          this.closeModal()
          await this.loadScenes()
        } else {
          this.$message?.error(response.message || '添加场景失败')
        }
      } catch (error) {
        console.error('添加场景失败:', error)
        this.$message?.error('添加场景失败，请稍后重试')
      } finally {
        this.submitting = false
      }
    },
    
    async updateScene() {
      try {
        this.submitting = true
        const response = await sceneApi.updateScene(this.formData)
        if (response.code === 0) {
          this.$message?.success('场景更新成功')
          this.closeModal()
          await this.loadScenes()
        } else {
          this.$message?.error(response.message || '更新场景失败')
        }
      } catch (error) {
        console.error('更新场景失败:', error)
        this.$message?.error('更新场景失败，请稍后重试')
      } finally {
        this.submitting = false
      }
    },
    
    async confirmDelete() {
      if (!this.sceneToDelete) return
      
      try {
        this.deleting = true
        const response = await sceneApi.deleteScene(this.sceneToDelete.sceneId)
        if (response.code === 0) {
          this.$message?.success('场景删除成功')
          this.closeDeleteModal()
          await this.loadScenes()
        } else {
          this.$message?.error(response.message || '删除场景失败')
        }
      } catch (error) {
        console.error('删除场景失败:', error)
        this.$message?.error('删除场景失败，请稍后重试')
      } finally {
        this.deleting = false
      }
    },
    
    // 地标管理
    async manageLandmarks(scene) {
      this.selectedScene = scene
      this.showLandmarkModal = true
      await this.loadLandmarks(scene.sceneId)
    },
    
    async loadLandmarks(sceneId) {
      try {
        const response = await sceneApi.getLandmarksBySceneId(sceneId)
        if (response.code === 0) {
          this.landmarks = response.data || []
        } else {
          this.$message?.error(response.message || '获取地标列表失败')
        }
      } catch (error) {
        console.error('加载地标失败:', error)
        this.$message?.error('加载地标失败，请稍后重试')
      }
    },
    
    editLandmark(landmark) {
      this.editingLandmark = landmark
      this.landmarkFormData = { ...landmark }
      this.showEditLandmarkModal = true
    },
    
    deleteLandmark(landmark) {
      this.landmarkToDelete = landmark
      // 这里可以添加删除地标的确认弹窗，简化处理直接删除
      this.confirmDeleteLandmark()
    },
    
    async addLandmark() {
      try {
        this.submitting = true
        this.landmarkFormData.sceneId = this.selectedScene.sceneId
        const response = await sceneApi.createLandmark(this.landmarkFormData)
        if (response.code === 0) {
          this.$message?.success('地标添加成功')
          this.closeLandmarkFormModal()
          await this.loadLandmarks(this.selectedScene.sceneId)
        } else {
          this.$message?.error(response.message || '添加地标失败')
        }
      } catch (error) {
        console.error('添加地标失败:', error)
        this.$message?.error('添加地标失败，请稍后重试')
      } finally {
        this.submitting = false
      }
    },
    
    async updateLandmark() {
      try {
        this.submitting = true
        const response = await sceneApi.updateLandmark(this.landmarkFormData)
        if (response.code === 0) {
          this.$message?.success('地标更新成功')
          this.closeLandmarkFormModal()
          await this.loadLandmarks(this.selectedScene.sceneId)
        } else {
          this.$message?.error(response.message || '更新地标失败')
        }
      } catch (error) {
        console.error('更新地标失败:', error)
        this.$message?.error('更新地标失败，请稍后重试')
      } finally {
        this.submitting = false
      }
    },
    
    async confirmDeleteLandmark() {
      if (!this.landmarkToDelete) return
      
      try {
        const response = await sceneApi.deleteLandmark(this.landmarkToDelete.landmarkId)
        if (response.code === 0) {
          this.$message?.success('地标删除成功')
          await this.loadLandmarks(this.selectedScene.sceneId)
        } else {
          this.$message?.error(response.message || '删除地标失败')
        }
      } catch (error) {
        console.error('删除地标失败:', error)
        this.$message?.error('删除地标失败，请稍后重试')
      } finally {
        this.landmarkToDelete = null
      }
    },
    
    // 弹窗控制
    closeModal() {
      this.showAddModal = false
      this.showEditModal = false
      this.resetForm()
    },
    
    closeDeleteModal() {
      this.showDeleteModal = false
      this.sceneToDelete = null
    },
    
    closeLandmarkModal() {
      this.showLandmarkModal = false
      this.selectedScene = null
      this.landmarks = []
    },
    
    closeLandmarkFormModal() {
      this.showAddLandmarkModal = false
      this.showEditLandmarkModal = false
      this.resetLandmarkForm()
    },
    
    resetForm() {
      this.formData = {
        sceneId: '',
        sceneName: '',
        sceneType: '',
        backgroundStory: '',
        sceneImageUrl: ''
      }
      this.editingScene = null
    },
    
    resetLandmarkForm() {
      this.landmarkFormData = {
        landmarkId: '',
        landmarkName: '',
        landmarkDesc: '',
        landmarkImageUrl: '',
        visualResourceId: '',
        sceneId: ''
      }
      this.editingLandmark = null
    }
  }
}
</script>

<style scoped>
.scene-management {
  padding: 2rem;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
}

.management-header {
  text-align: center;
  margin-bottom: 2rem;
}

.management-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.management-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
}

.management-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.toolbar-left {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  padding: 0.8rem 2.5rem 0.8rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.8);
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 300px;
}

.search-icon {
  position: absolute;
  right: 0.8rem;
  color: var(--text-muted);
}

.filter-select {
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.8);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.filter-select option {
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
}

.add-btn {
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.add-btn.small {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.btn-icon {
  font-size: 1.2rem;
}

.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.scene-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.scene-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.scene-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.scene-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.scene-card:hover .scene-img {
  transform: scale(1.05);
}

.scene-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scene-card:hover .scene-overlay {
  opacity: 1;
}

.scene-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: white;
  transform: scale(1.1);
}

.edit-btn:hover {
  background: #4ecdc4;
  color: white;
}

.delete-btn:hover {
  background: #ff6b6b;
  color: white;
}

.landmark-btn:hover {
  background: #ffa726;
  color: white;
}

.scene-info {
  padding: 1.5rem;
}

.scene-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.scene-type {
  color: var(--primary-color);
  font-weight: 500;
  margin-bottom: 0.8rem;
}

.scene-description {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.page-btn {
  padding: 0.8rem 1.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.page-btn:hover:not(.disabled) {
  background: var(--primary-color);
  color: white;
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-weight: 500;
  color: var(--text-primary);
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.landmark-modal {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.3rem;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

.form-group select option {
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
}

.cancel-btn {
  padding: 0.8rem 1.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.submit-btn {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  color: white;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.delete-confirm-btn {
  padding: 0.8rem 1.5rem;
  background: #ff6b6b;
  color: white;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.delete-confirm-btn:hover:not(:disabled) {
  background: #ff5252;
  transform: translateY(-2px);
}

.delete-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.warning-text {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* 地标管理样式 */
.landmark-toolbar {
  margin-bottom: 1.5rem;
}

.landmarks-list {
  max-height: 400px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.landmark-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.landmark-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.landmark-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.landmark-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landmark-info {
  flex: 1;
}

.landmark-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.landmark-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.landmark-actions {
  display: flex;
  gap: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .scene-management {
    padding: 1rem;
  }
  
  .management-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-left {
    flex-direction: column;
  }
  
  .search-input {
    width: 100%;
  }
  
  .scenes-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
    margin: 1rem;
  }
  
  .landmark-item {
    flex-direction: column;
    text-align: center;
  }
  
  .landmark-image {
    align-self: center;
  }
}
</style>